<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Test Case for Issue #1693</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>

<h1>Issue #1693</h1>

<p>This test-case is intended for <a href="http://code.google.com/p/fbug/issues/detail?id=1693">Issue #1693</a>
- <span class="h3">Viewing requests with large message bodies in Console tab temporarily freezes browser</span>.

<br/>
<i>Jan Odvarko, odvarko@gmail.com</i>
</p>

<ol>
    <li>Open Firebug and enable Console panel.</li>
    <li>Click the <i>Execute XHR</i> button.</li>
    <li>As soon as the XHR finishes, open the new XHR entry.</li>
    <li>Firebug shouldn't freeze and the response should be displayed.</li>
</ol>

<i>The response text should be limited at the end since it's too big to display.</i>
<br/><br/>
<button id="testButton" onclick="executeRequest()">Execute XHR</button>
<span id="progress"></span>

<script type="text/javascript">
function executeRequest()
{
    var responseSize = 468890;
    var request = new XMLHttpRequest();
    request.open("POST", "issue1693.php", true);
    request.onreadystatechange = function()
    {
        if (request.readyState >= 3)
        {
            var event = document.createEvent("Events");
            event.initEvent("data-received", true, false);
            document.dispatchEvent(event);

            var progress = document.getElementById("progress");
            var size = request.responseText.length;
            progress.innerHTML = Math.round((size / responseSize) * 100) + "% (" + size + "B)";

            if (size == responseSize)
            {
                var event = document.createEvent("Events");
                event.initEvent("data-complete", true, false);
                document.dispatchEvent(event);
            }
        }
    }
    request.send(null);
}
</script>
</body>
</html>
